define(function(require, exports, module) {
    var ALL = require("../../common/all"),
        CONFIG = ALL.CONFIG,
        METHOD = ALL.METHOD,
        Dialog = ALL.Dialog,
        Init = ALL.Init;

    var _Dialog = new Dialog({
        title : "提示",
        content : "<p>是否确定变更？</p>",
        text4Btn: ["确定","取消"],
        class4Btn: ["","line"]
    });

    var _vm = Init.initVue({
        data : {
            check: {},
            res : {
                no : "",
                name : "",
                type : "",
                leader : "",
                leader_name : "",
                team_sn : ""
            }
        },
        methods: {
            submit : function() {
                var obj,
                    flag;

                this.check.$valid();
                flag = this.check.flag;

                if (!flag) { return; }

                obj = {
                    no: _vm.res.no,
                    leader: _vm.res.leader
                }

                _Dialog.showUI(function(i) {
                    if (i == 0) {
                        METHOD.loading.show();
                        METHOD.ajax("team/transfer/modify",obj,{type : 'post'}).done(function(){
                            METHOD.loading.hide();
                            METHOD.alert("操作成功").done(function(){
                                window.location.href = "../team/modify.html";
                            });
                        }).fail(function(){
                            METHOD.loading.hide();
                        });
                    }
                    this.hideUI();
                });
            },
            getInfoCallback1 : function(obj) {
                if (obj) {
                    this.res.name = obj.name;
                    if (obj.is_captain) {
                        this.res.type = 1;
                    } else {
                        this.res.type = 2;
                    }
                } else {
                    this.res.user_name = "";
                }
            },
            getInfoCallback2 : function(obj) {
                if (obj) {
                    this.res.leader_name = obj.name;
                    this.res.team_sn = obj.team_sn;
                } else {
                    this.res.user_name = "";
                }
            },
        }
    });

});

